use log::info;
use rocket::fairing::{Fairing, Info, Kind};
use rocket::{Request, Response};

pub struct LoggingMiddleWare;

#[rocket::async_trait]
impl Fairing for LoggingMiddleWare {
    fn info(&self) -> Info {
        Info {
            name: "Error",
            kind: Kind::Response,
        }
    }

    async fn on_response<'r>(&self, _req: &'r Request<'_>, res: &mut Response<'r>) {
        info!("response:{:?}", res);
    }
}
